<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/static/css/mycss.css}">
    <script th:src="@{/static/js/jquery.min.js}"></script>
    <script th:src="@{/static/js/bootstrap.min.js}"></script>
    <script th:src="@{/static/js/myjs.js}"></script>
    <title>index</title>
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <nav class="navbar navbar-default" role="navigation">
                <div class="navbar-header">
                    <a class="navbar-brand" href="#">LemonAPM(V0.9)</a>
                </div>

                <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                    <ul class="nav navbar-nav">
                        <li class="active">
                            <a href="/apm/index">我的主机</a>
                        </li>
                        <li>
                            <a href="/apm/cpu">cpu监控</a>
                        </li>
                        <li>
                            <a href="/apm/memory">内存监控</a>
                        </li>
                        <li>
                            <a href="/apm/disk">磁盘监控</a>
                        </li>
                        <li>
                            <a href="#">主机报警(建设中)</a>
                        </li>
                        <li>
                            <a href="/apm/setting">设置</a>
                        </li>
                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="/apm/logout">登出</a>
                        </li>
                    </ul>
                </div>
            </nav>
            <div th:if="${data != null}">
                <h3>机器概览</h3>
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>数据token</th>
                            <th>机器名称</th>
                            <th>OS</th>
                            <th>cpu型号</th>
                            <th>cpu使用率(%)</th>
                            <th>硬盘使用情况(使用/总量)(GB)</th>
                            <th>内存使用情况(使用/总量)(GB)</th>
                            <th>最近上报数据时间</th>
                        </tr>
                    </thead>
                    <tbody>
                    <tr th:each="machine : ${data}">
                        <td th:text="${machine.dataToken}">数据token</td>
                        <td th:if="${machine.pcName != null}" th:text="${machine.pcName}"></td>
                        <td th:if="${machine.pcName == null}">--</td>

                        <td th:if="${machine.osName != null}" th:text="${machine.osName}"></td>
                        <td th:if="${machine.osName == null}">--</td>

                        <td th:if="${machine.cpuModel != null}" th:text="${machine.cpuModel}"></td>
                        <td th:if="${machine.cpuModel == null}">--</td>

                        <td th:if="${machine.cpuUsage != null}" th:text="${machine.cpuUsage}"></td>
                        <td th:if="${machine.cpuUsage == null}">--</td>

                        <td th:if="${machine.diskTotal != null}" th:text="${machine.diskUse} + '/' + ${machine.diskTotal}"></td>
                        <td th:if="${machine.diskTotal == null}">--</td>

                        <td th:if="${machine.memoryTotal != null}" th:text="${machine.memoryUse} + '/' + ${machine.memoryTotal}"></td>
                        <td th:if="${machine.memoryTotal == null}">--</td>

                        <td th:if="${machine.dateStr != null}" th:text="${machine.dateStr}"></td>
                        <td th:if="${machine.dateStr == null}">--</td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <div th:if="${data == null}">
                <h3>当前账号还未注册机器，可以前往设置页面注册</h3>
            </div>
        </div>
    </div>
</div>
</body>
</html>